{extend name="base" /}
{block name="title"}保险录入{/block}
{block name="bread"}
<div class="bread-cram">
    <div class="bread-cram-inner">
        <span class="title">保险公司使用</span>
        <span class='sub-title'>- 保险录入</span>
    </div>
</div>
{/block}
{block name="main"}
<div class="menu-content left">
            <div class="menu-content-title"><p>资料录入</p></div>
            <div class="step-box">
              <div class="active">保单险种</div>
              <div class="active">货品信息</div>
              <div class="active">货品受损</div>
              <div>货品现状</div>
              <div>物权信息</div>
              <div>递交授权</div>
            </div>
            <div class="msg-tip" style="text-align: center">
              *以下资料作为法律责任依据请如实填写,<a>查看模板>></a>
            </div>
            <div class="form-box">
                <div class="form-content">
                        <div class="form-item">
                                <label>受损时间：</label>
                                <input type="text" placeholder="请选择时间"  id="damage_at"/>
                              </div>
                              <div class="form-item textarea">
                                <label class="vtt">受损原因：</label>
                                <textarea type="text" placeholder="请填写受损原因" id="damage_result" ></textarea>
                              </div>
                              <div class="form-item">
                                <label>货品所在地：</label>
                                <input type="text" placeholder="请选择省市区" class="address" name="addr"/>
                                <input type="text" placeholder="详细门牌地址" class="address-detail" name="address_detail"/>
                              </div>
                              <div class="form-item uploader-box">
                                    <label>第三方报告（选填）：</label>
                                    <div class="uploader">
                                            <ul id="uploader-files" class="uploader-files">
                                                <li class="uploader-file" style="background-image: url(&quot;http://temp.im/288x288/FF9500/000&quot;);"><span class="close">x</span></li>
                                            </ul>
                                            <div class="uploader-content">
                                                <div class="uploader-input-box"><input type="file" accept="image/*" class="uploader-input"></div>
                                            </div>
                                        </div>
                                  </div>
                </div>
                <div class="form-footer">
                        <div class="step-btn-box">
                          <div class="pre-btn" onclick="javascript:history.go(-1);">上一步</div>
                          <div class="next-btn">下一步</div>
                        </div>
                      </div>
            </div>
          </div>
<input type="hidden" value="{$policy_num}" name ='policy_num'>
{/block}


{block name="js"}
<script type="text/javascript">
    $(function() {

        var laydate = layui.laydate;
        //常规用法
        laydate.render({
            elem: '#damage_at'
        });

        $('.next-btn').on('click',function(){
          //  location.href= "{:url('insurer/step4')}";
            var poliecy = $("input[ name='policy_num']").val();
            var damage_at= $("#damage_at").val();
            var damage_result= $("#damage_result").val();
            var address_detail = $("input[ name='address']").val();
            //还有省市区，文件
            $.ajax({
                type: 'POST',
                url: "{:url('insurer/addInsurer')}",
                data: {
                    'policy_num': poliecy,
                    'damage_at': damage_at,
                    'damage_result': damage_result,
                    'omit': '',
                    'city': '上海市',
                    'classify': '浦东新区   ',
                    'address_detail':address_detail,
                    'other_report':JSON.stringify( ['http://rongyp.oss-cn-shanghai.aliyuncs.com/12345你.doc','http://rongyp.oss-cn-shanghai.aliyuncs.com/12345你.doc'] ),
                    'now_status':3
                },
                dataType: 'json',
                success: function (Json) {
                    if (Json.code == 200) {
                        location.href="{:url('insurer/step4')}?policy_num="+Json.data.policy_num;
                    } else {
                        layer.msg('保存失败', {icon: 2});
                    }
                }
            });
        });

    });



</script>
{/block}